package com.rxkj.fxx.face.base;

import android.os.Bundle;
import android.widget.Toast;

import com.rxkj.fxx.face.widget.LoadingBar;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * @ProjectName: FaceRecognition
 * @Package: com.rxkj.fxx.face.base
 * @ClassName: BaseActivity
 * @Description:
 * @Author: 付小歆
 * @CreateDate: 2021/12/24 15:02
 */
public class BaseActivity extends AppCompatActivity {

    /**
     * loading弹框
     *
     * @param savedInstanceState
     */
    private LoadingBar loadingBar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        loadingBar = new LoadingBar(this);
    }

    protected void showLoading() {
        if (loadingBar != null)
            loadingBar.show();
    }

    protected void showLoading(String hint) {
        if (loadingBar != null)
            loadingBar.canCancellable(false);
        loadingBar.show(hint);
    }

    protected void dissmissLoading() {
        if (loadingBar != null && loadingBar.isShowing())
            loadingBar.dissmiss();
    }

    protected void showToast(String msg) {
        Toast toast = Toast.makeText(this, "",
                Toast.LENGTH_SHORT);
        toast.setText(msg);
        toast.show();
    }
}
